package cn.com.nes.mybatis.agent.crm.mapper;

import cn.com.nes.mybatis.agent.crm.entity.Opportunity;
import cn.com.nes.site.service.crm.customer.bo.CustomerOpportunityBo;
import cn.com.nes.site.service.crm.opportunity.bo.GetOpportunityDetailBO;
import cn.com.nes.site.service.crm.opportunity.bo.QueryOpportunityBO;
import cn.com.nes.site.service.crm.opportunity.bo.QueryOpportunityPageBO;
import cn.com.nes.site.service.crm.opportunity.dto.OpportunityAndContractDTO;
import cn.com.nes.site.service.crm.opportunity.dto.OpportunityDTO;
import cn.com.nes.site.service.crm.opportunity.dto.OpportunityInfoDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * @author yishuai
 */
public interface OpportunityMapper extends BaseMapper<Opportunity> {

    Integer getOpportunityCountByCustomerId(@Param("customerId") String customerId);


    List<OpportunityAndContractDTO> getOpportunitiesContainContract(QueryOpportunityBO queryOpportunityBo);


    /**
     * 删除商机
     * @param deletedCustomerIds 要删除的客户ID列表
     * @param operateUserId      操作人ID
     * @param operateDate        操作时间
     */
    void deleteByCustomerIds(@Param("deletedCustomerIds") List<String> deletedCustomerIds,
            @Param("operateUserId") Long operateUserId, @Param("operateDate") Date operateDate);


    List<OpportunityDTO> getCustomerOpportunityList(CustomerOpportunityBo customerOpportunityBo);


    OpportunityInfoDto getOpportunityInfoDto(GetOpportunityDetailBO bo);


    List<OpportunityInfoDto> getOpportunityPage(@Param("page") Page<OpportunityInfoDto> page, @Param("bo") QueryOpportunityPageBO bo);

    OpportunityInfoDto getOpportunityDetailByWorkOrderId(@Param("workOrderId") Long workOrderId);
}




